include('shared.lua')

//thanks to brwarner for this
function ShowIrisMenu(player, command, args)
	local panel = vgui.Create("Frame")
	panel:SetSize(300, 150)
	panel:SetPos((ScrW()/2 - 350) / 2, ScrH()/2 - 75)
	panel:SetVisible(true)
	panel:MakePopup()
	panel:PostMessage( "SetTitle", "text", "Set Iris Settings")
	
	local text = vgui.Create( "TextEntry", panel)
	text:SetText(args[1])
	text:SetPos( 30, 30)
	text:SetSize(200, 30)	
	text:SetTooltip("Type the iris code you want to check for here.")

	local button = vgui.Create("Button", panel)
	button:SetText("Save Settings")
	button:SetPos(30, 120)
	button:SetSize(80, 25)
	
	local toggle = vgui.Create("CheckButton", panel)
	toggle:SetTooltip("If checked, the gate will close as soon as an incoming connection is established.")
	toggle:SetText("Autoclose?")
	toggle:SetPos(30, 70)
	toggle:SetSize(100, 30)
	
	function button:DoClick()
		val = toggle:GetValue()
		LocalPlayer():ConCommand("changeirissettings " .. tonumber(text:GetValue()) .. " " .. tostring(toggle:GetValue()) .. "\n")
		panel:Remove()
	end
end

concommand.Add("showirismenu", ShowIrisMenu)